<?php 
if(!isset($_SESSION)) 
{ 
	session_start(); 
}
	
$lang = $_SESSION['lang'];
if (empty($lang) || $lang == "EN") {
	include "../value/value_en.php";
} else if($lang == "VN") {
	include "../value/value_vn.php";
}
else {
	include "../value/value_kr.php";
}
$mkq_check=array($l_can_import,$l_can_not_import);
if (isset($_SESSION['mysheets']) && is_array($_SESSION['mysheets'])){
	include 'CheckTime.php';
	//include '../operations/connection.php';
	$tempsql = "";
	echo '<div style="width:100%;text-align:left;padding-left:3px;padding-top:10px;padding-bottom:10px;" ><font color="red"><b>(*)</b></font> <font color="green"><b>'.$l_tb_import_sa.' ( <img src="images/check_sa.png" style="width:20px;height:20px" title="'.$mkq_check[0].'"/> )</b></font><br></div>';
	echo '<table style="width:100%;text-align:center;" class="rf-dt"><tr>';
	echo '<td class="rf-dt-shdr-c" width="20px"></td>';
	echo '<td class="rf-dt-shdr-c" width="20%">'.$l_employee_name.'</td>';
	echo '<td class="rf-dt-shdr-c" width="10%">'.$l_code.'</td>';
	echo '<td class="rf-dt-shdr-c" width="10%">'.$l_date.'</td>';
	echo '<td class="rf-dt-shdr-c" width="8%">'.$l_timecheckin.'</td>';
	echo '<td class="rf-dt-shdr-c" width="8%">'.$l_timecheckout.'</td>';
	echo '<td class="rf-dt-shdr-c" width="5%">'.$l_late.'</td>';
	echo '<td class="rf-dt-shdr-c" width="5%">'.$l_comebackearly.'</td>';
	echo '<td class="rf-dt-shdr-c" width="5%">'.$l_half_dayoff.'</td>';
	echo '<td class="rf-dt-shdr-c" width="5%">'.$l_all_dayoff.'</td>';
	echo '<td class="rf-dt-shdr-c" width="5%">'.$l_overtime.'</td>';
	echo '<td class="rf-dt-shdr-c" >'.$l_note.'</td>';
	echo '<td class="rf-dt-shdr-c" width="20px">'.$l_result_checkdata.'</td></tr>';
	$dem=0;
	if(count($_SESSION['mysheets'])>0){
		foreach ($_SESSION['mysheets'] as $sheetkey =>  $sheetobject){
			echo '<tr  class="hang"><td colspan="13" class="rf-dt-c" style="text-align:left;"><b>',$sheetkey,'</b></tr>';
			foreach ($sheetobject as $key =>  $object){
				$CT = unserialize (serialize ($object));
				if($CT->vitri==$_REQUEST['vitri']){
					unset($_SESSION['mysheets'][$sheetkey][$_REQUEST['vitri']]);
					if(array_key_exists ($_REQUEST['vitri'], $_SESSION['rs_mysheets'])==true){
						unset($_SESSION['rs_mysheets'][$_REQUEST['vitri']]);
					}
				}else{
					$dem++;
					echo '<tr  class="hang">';
				
					echo '<td class="rf-dt-c">';
					echo '<img onclick="deleteclick('.$CT->vitri.')" src="images/del.png" style="width:20px;height:20px;cursor:pointer;" title="'.$l_delete.'" />';
					echo '</td>';
					
					echo '<td class="rf-dt-c" style="text-align:left;">';
					echo $CT->employeeName;
					echo '</td>';
	
					echo '<td class="rf-dt-c">';
					echo $CT->employeeID;
					echo '</td>';
	
					echo '<td class="rf-dt-c">';
	
					echo $CT->date;
					echo '</td>';
	
					echo '<td class="rf-dt-c">';
					if ($CT->inTime != '0') echo $CT->inTime;
					echo '</td>';
	
					echo '<td class="rf-dt-c">';
					if ($CT->outTime != '0') echo $CT->outTime;
					echo '</td>';
	
					echo '<td class="rf-dt-c">';
					if ($CT->late != '0') echo $CT->late;
					echo '</td>';
	
					echo '<td class="rf-dt-c">';
					if ($CT->early != '0') echo $CT->early;
					echo '</td>';
	
					echo '<td class="rf-dt-c">';
					if ($CT->halfDayOff != '0') echo $CT->halfDayOff;
					echo '</td>';
	
					echo '<td class="rf-dt-c">';
					if ($CT->aDayOff != '0') echo $CT->aDayOff;
					echo '</td>';
	
					echo '<td class="rf-dt-c">';
					if ($CT->overtime != '0') echo $CT->overtime;
					echo '</td>';
	
					echo '<td class="rf-dt-c">';
					echo $CT->note;
					echo '</td>';
					
					echo '<td class="rf-dt-c">';
					if($CT->checkvalue==1){
						echo '<img src="images/Restricted Icon.jpg" style="width:20px;height:20px" title="'.$mkq_check[$CT->checkvalue].'" />';
					}else{
						echo '<img src="images/check_sa.png" style="width:20px;height:20px" title="'.$mkq_check[$CT->checkvalue].'"/>';
					}
					echo '</td>';
					
					echo '</tr>';
				}
				
			}
		}
	}else{
		echo '<tr  class="hang"><td colspan="13" class="rf-dt-c" style="text-align:left;">'.$l_list_emplty.'</tr>';
	}
	
	echo '</table>';
	if(isset($_SESSION['rs_mysheets']) && count($_SESSION['rs_mysheets'])>0){
		echo '<div style="width:100%;text-align:center;padding:20px;" > <a href="content_salary/CheckTimeSave.php"><input type="button" value="'.$l_save.'" class="btnupbg btnupload"/></a></div>';
	}else{
		if($dem>0){
			echo '<div style="width:100%;text-align:center;padding:20px;font-weight:bold;color:red;">'.$l_salary_exit_not_input_spread_again.'</div>';
		}else{
			echo '<div style="width:100%;text-align:center;padding:20px;font-weight:bold;color:red;">'.$l_list_emplty.'</div>';
		}
	}
	//mysql_close($connection);
}
?>